package com.ibuonline.b2b.entity;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

import org.apache.commons.lang.StringUtils;

public class SeoHotKeywords implements Serializable {

	private static final long serialVersionUID = -7141011694113554971L;

	//fields
	private java.lang.Integer id;
	private java.lang.String name;
	private java.lang.Integer displayOrder;
	private java.lang.Integer parentId;
	private java.lang.Integer clickCount;
	private java.sql.Timestamp lastupdate;

	//default constructor
	public SeoHotKeywords() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.String getName() {
		return name;
	}
	public java.lang.Integer getDisplayOrder() {
		return displayOrder;
	}
	public java.lang.Integer getParentId() {
		return parentId;
	}
	public java.lang.Integer getClickCount() {
		return clickCount;
	}
	public java.sql.Timestamp getLastupdate() {
		return lastupdate;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setName(java.lang.String name) {
		this.name = name;
	}
	public void setDisplayOrder(java.lang.Integer displayOrder) {
		this.displayOrder = displayOrder;
	}
	public void setParentId(java.lang.Integer parentId) {
		this.parentId = parentId;
	}
	public void setClickCount(java.lang.Integer clickCount) {
		this.clickCount = clickCount;
	}
	public void setLastupdate(java.sql.Timestamp lastupdate) {
		this.lastupdate = lastupdate;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof SeoHotKeywords))
			return false;

		final SeoHotKeywords seoHotKeywords = (SeoHotKeywords)other;
		if (!this.id.equals(seoHotKeywords.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("SeoHotKeywords[")
			.append("id=").append(id).append(", ")
			.append("name=").append(name).append(", ")
			.append("displayOrder=").append(displayOrder).append(", ")
			.append("parentId=").append(parentId).append(", ")
			.append("clickCount=").append(clickCount).append(", ")
			.append("lastupdate=").append(lastupdate).append("]").toString();
	}
	
	///################
	public String getEncodeName() {
		if(StringUtils.isNotBlank(name)) {
			try {
				return java.net.URLEncoder.encode(name,"GBK");
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}
		return "";
	}
}